<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var a = prompt("输入第一个数");
      var b = prompt("输入第二个数");
      //解题思路 循环 看a b直接有多少奇数  最后结果是奇数个数*（b到a一共多少数据)
      function print_arr(i, a, b) {
        for (j = a; j <= b; j++) {
          var tmp = j + String(i);
          document.write(tmp + "&nbsp;");
        }
      }
      function calc(a, b) {
        var tag = 0;
        for (i = a; i <= b; i++)
          if (i % 2 != 0) {
            tag++;
            print_arr(i, a, b);
            //执行所有a-b和i的组合打印
          }
        document.write("<br>");
        var res = (b - a + 1) * tag;
        document.write(res + "个奇数");
      }
      calc(a, b);
    </script>
  </body>
</html>
